﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.TK
{
    class Class11
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                da.Value = ppa.Amount * (1 + (0.05 * ppa.Period + 1));
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period==(ppa.PolicyActing.PeriodActings.Count()-1))
            {
                da.Value = ppa.Amount * (1 + (0.05 * ppa.Period + 1));
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.HolderStates.Contains("身故") && ppa.Period>0)
            {
                ppa.Fee = 0;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故") && ppa.Age <100)
            {
                da.Value = ppa.Amount;
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age == 30)
            {
                da.Value = ppa.Amount;
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if ((ppa.Period+1) % 3==0 && ppa.Age !=100)
            {
                da.Value = ppa.Amount * 0.09;
            }

            if (ppa.Age == 100)
            {
                da.Value = ppa.Amount;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("重疾"))
            {
                if (ppa.Age < 60)
                {
                    da.Value = ppa.Amount * 2;
                }
                else
                {
                    da.Value = ppa.Amount;
                }
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age == 60)
            {
                da.Value = ppa.Amount;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period > 0)
            {
                double f = (double)ppa.SchemePeriodActing.SchemeActing.GetAuxConfigValue("分红率(预估)");

                da.Value = ppa.TotalFee * f;
            }
        }
    }
}
